#include "window_zoom.h"
#include "window_main.h"	
#include <math.h>
#include "window_manager.h"

/****X轴中心坐标******/
uint16_t X_Center   =  360/2;
/****Y轴中心坐标******/
uint16_t Y_Center   =  360/2;
/****图像缩放标志位******/
uint8_t zoom_flag=0; 
/****方向判断******/
ZOOM_DIR_t ZOOM_dir=NONE; 
/****保存获取当前所有界面上对象个数******/
uint32_t child_cnt =0;    



typedef struct
{
	 void * image;  //图片
}Play_t;







#if 0
#define X_INTERVAL    64    //元素间的X间距
#define Y_INTERVAL    64    //元素间的Y间距
#define X_CENTER_X_POS   151
#define Y_CENTER_Y_POS   151
#define X_INTERVAL_ROW    35   //元素间的X间距
#define Y_INTERVAL_COL    8    //元素间的Y间距

#define X_POS_ROOM_POS    30
#define Y_POS_ROOM_POS    30

#else
#define X_INTERVAL    68        //元素间的X间距
#define Y_INTERVAL    64        //元素间的Y间距
#define X_CENTER_X_POS   148  
#define Y_CENTER_Y_POS   148
#define X_INTERVAL_ROW    35    //元素间的X间距
#define Y_INTERVAL_COL    8     //元素间的Y间距

#define X_POS_ROOM_POS    35    //X左边界区域    X右边界区域 
#define Y_POS_ROOM_POS    35    //Y上边界区域    Y下边界区域

#endif

/****记录当前的每个对象缩放的索引值******/
int8_t Menu_index[Max_Menu_Num]={0};



#if  1

static Play_t Small_BP[]=
{
	
[0]		={.image=(void *)&z_z_menu_slide_Small_BP_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_BP_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_BP_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_BP_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_BP_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_BP_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_BP_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_BP_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_BP_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_BP_64},	

};

static Play_t Small_Breathe[]=
{
[0]		={.image=(void *)&z_z_menu_slide_Small_Breathe_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_Breathe_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_Breathe_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_Breathe_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_Breathe_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_Breathe_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_Breathe_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_Breathe_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_Breathe_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_Breathe_64},	

};

              
static Play_t Small_Calculator[]=
{
[0]		={.image=(void *)&z_z_menu_slide_Small_Calculator_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_Calculator_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_Calculator_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_Calculator_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_Calculator_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_Calculator_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_Calculator_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_Calculator_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_Calculator_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_Calculator_64},	

};

static Play_t Small_camera[]=
{
	
[0]		={.image=(void *)&z_z_menu_slide_Small_camera_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_camera_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_camera_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_camera_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_camera_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_camera_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_camera_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_camera_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_camera_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_camera_64},	

};

static Play_t Small_CountDown[]=
{
	
[0]		={.image=(void *)&z_z_menu_slide_Small_CountDown_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_CountDown_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_CountDown_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_CountDown_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_CountDown_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_CountDown_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_CountDown_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_CountDown_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_CountDown_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_CountDown_64},	

};

static Play_t Small_data[]=
{	
[0]		={.image=(void *)&z_z_menu_slide_Small_data_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_data_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_data_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_data_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_data_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_data_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_data_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_data_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_data_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_data_64},	
};

static Play_t Small_hr[]=
{
[0]		={.image=(void *)&z_z_menu_slide_Small_hr_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_hr_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_hr_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_hr_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_hr_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_hr_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_hr_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_hr_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_hr_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_hr_64},	
};

static Play_t Small_message[]=
{
[0]		={.image=(void *)&z_z_menu_slide_Small_message_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_message_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_message_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_message_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_message_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_message_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_message_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_message_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_message_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_message_64},	
};


static Play_t Small_met[]=
{
[0]		={.image=(void *)&z_z_menu_slide_Small_met_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_met_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_met_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_met_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_met_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_met_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_met_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_met_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_met_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_met_64},	

};

static Play_t Small_music[]=
{
[0]		={.image=(void *)&z_z_menu_slide_Small_music_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_music_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_music_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_music_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_music_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_music_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_music_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_music_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_music_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_music_64},	
};

static Play_t Small_Outdoorsports[]=
{
[0]		={.image=(void *)&z_z_menu_slide_Small_Outdoorsports_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_Outdoorsports_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_Outdoorsports_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_Outdoorsports_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_Outdoorsports_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_Outdoorsports_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_Outdoorsports_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_Outdoorsports_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_Outdoorsports_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_Outdoorsports_64},	

};
static Play_t Small_Phone[]=
{	
[0]		={.image=(void *)&z_z_menu_slide_Small_Phone_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_Phone_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_Phone_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_Phone_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_Phone_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_Phone_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_Phone_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_Phone_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_Phone_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_Phone_64},	

};

static Play_t Small_settings[]=
{
[0]		={.image=(void *)&z_z_menu_slide_Small_settings_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_settings_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_settings_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_settings_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_settings_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_settings_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_settings_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_settings_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_settings_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_settings_64},	

};
static Play_t Small_Sleep[]=
{
[0]		={.image=(void *)&z_z_menu_slide_Small_Sleep_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_Sleep_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_Sleep_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_Sleep_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_Sleep_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_Sleep_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_Sleep_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_Sleep_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_Sleep_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_Sleep_64},	

};

static Play_t Small_spo2[]=
{	
[0]		={.image=(void *)&z_z_menu_slide_Small_spo2_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_spo2_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_spo2_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_spo2_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_spo2_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_spo2_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_spo2_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_spo2_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_spo2_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_spo2_64},	

};
static Play_t Small_Stopwatch[]=
{		
[0]		={.image=(void *)&z_z_menu_slide_Small_Stopwatch_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_Stopwatch_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_Stopwatch_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_Stopwatch_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_Stopwatch_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_Stopwatch_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_Stopwatch_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_Stopwatch_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_Stopwatch_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_Stopwatch_64},	

};



static Play_t Small_weather[]=
{
	
[0]		={.image=(void *)&z_z_menu_slide_Small_weather_28},
[1]		={.image=(void *)&z_z_menu_slide_Small_weather_32},
[2]		={.image=(void *)&z_z_menu_slide_Small_weather_36},
[3]		={.image=(void *)&z_z_menu_slide_Small_weather_40},
[4]		={.image=(void *)&z_z_menu_slide_Small_weather_44},
[5]		={.image=(void *)&z_z_menu_slide_Small_weather_48},
[6]		={.image=(void *)&z_z_menu_slide_Small_weather_52},
[7]		={.image=(void *)&z_z_menu_slide_Small_weather_56},
[8]		={.image=(void *)&z_z_menu_slide_Small_weather_60},
[9]		={.image=(void *)&z_z_menu_slide_Small_weather_64},	

};

#endif


#include "SEGGER_RTT.h"

//static lv_point_t vect=           {0};  //记录当前的坐标


void refresh_image( lv_obj_t * obj,uint8_t i,uint8_t index)
{
	#if 0
	     //设置当前的图片资源
				if(i==0)
				{
				   lv_img_set_src(obj, zoom_about[index].image);
				}else if(i==1){
						lv_img_set_src(obj, zoom_badminton[index].image);
				}else if(i==2){
						lv_img_set_src(obj, zoom_basketball[index].image);
				}else if(i==3){
						lv_img_set_src(obj, zoom_bp[index].image);
				}else if(i==4){
						lv_img_set_src(obj, zoom_brightness[index].image);
				}else if(i==5){
						lv_img_set_src(obj, zoom_climb[index].image);
				}else if(i==6){
				lv_img_set_src(obj, zoom_cycling[index].image);
				}else if(i==7){
				lv_img_set_src(obj, zoom_dial[index].image);
				}else if(i==8){
				lv_img_set_src(obj, zoom_find_phone[index].image);
				}else if(i==9){
				lv_img_set_src(obj, zoom_home[index].image);
				}else if(i==10){
				lv_img_set_src(obj, zoom_hr[index].image);
				}else if(i==11){
				lv_img_set_src(obj, zoom_message[index].image);
				}else if(i==12){
				lv_img_set_src(obj, zoom_music[index].image);
				}else if(i==13){
				lv_img_set_src(obj, zoom_o2[index].image);
				}else if(i==14){
				lv_img_set_src(obj, zoom_reset[index].image);
				}
		#else		
				//设置当前的图片资源
				if(i==0)
				{
				   lv_img_set_src(obj, Small_BP[index].image);
				}else if(i==1){
						lv_img_set_src(obj, Small_camera[index].image);
				}else if(i==2){
						lv_img_set_src(obj, Small_Calculator[index].image);
				}else if(i==3){
						lv_img_set_src(obj, Small_CountDown[index].image);
				}else if(i==4){
						lv_img_set_src(obj, Small_data[index].image);
				}else if(i==5){
						lv_img_set_src(obj, Small_hr[index].image);
				}else if(i==6){
				lv_img_set_src(obj, Small_message[index].image);
				}else if(i==7){
				lv_img_set_src(obj, Small_met[index].image);
				}else if(i==8){
				lv_img_set_src(obj, Small_music[index].image);
				}else if(i==9){
				lv_img_set_src(obj, Small_Outdoorsports[index].image);
				}else if(i==10){
				lv_img_set_src(obj, Small_Phone[index].image);
				}else if(i==11){
				lv_img_set_src(obj, Small_settings[index].image);
				}else if(i==12){
				lv_img_set_src(obj, Small_Sleep[index].image);
				}else if(i==13){
				lv_img_set_src(obj, Small_spo2[index].image);
				}else if(i==14){
				lv_img_set_src(obj, Small_Stopwatch[index].image);
				}
				else if(i==15){
				lv_img_set_src(obj, Small_weather[index].image);
				}else if(i==16){
				lv_img_set_src(obj, Small_weather[index].image);
				}
				else if(i==17){
				lv_img_set_src(obj, Small_Stopwatch[index].image);
				}else if(i==18){
				lv_img_set_src(obj, Small_spo2[index].image);
				}
				else if(i==19){
				lv_img_set_src(obj, Small_weather[index].image);
				}else if(i==20){
				lv_img_set_src(obj, Small_weather[index].image);
				}
				
				
				
				
		#endif
}
/************************************************
    获取当前的图片索引   //用于判断是否在放大缩小边缘
*/
uint8_t Get_Current_Index(lv_obj_t * obj)
{
 uint8_t result=0;
		  lv_coord_t width=lv_obj_get_width(obj);    //获取当前对象宽度
      lv_coord_t height=lv_obj_get_height(obj);  //获取当前对象高度
		  result=(width+height)/2;
	switch(result){
			case 0:
			return result;break;
			case 1:
			return result;break;
			case 2:
			return result;break;
			case 3:
			return result;break;
			case 4:
			return result;break;
			case 5:
			return result;break;
			case 6:
			return result;break;
			case 7:
			return result;break;
			case 8:
			return result;break;
			case 9:
			return result;break;
	}
}
//实现回调函数
__attribute__((section("ram_code"))) static void my_event_cb(lv_event_t * event)
{
	 lv_point_t vect = {0};  //记录当前的坐标
	#if 1
			//lv_dir_t  dir = lv_indev_get_gesture_dir(lv_indev_get_act());//获得手势的方向
			#if 1
			
				lv_indev_t * indev = lv_indev_get_act(); //获取当前的坐标
				if(indev == NULL)
				{
					return;
				}

				lv_indev_get_vect(indev, &vect);//获取当前偏移量
			//lv_indev_get_point(indev, &vect);//获取当前的坐标
				
			 lv_coord_t x =0;
			 lv_coord_t y=0;
			
			 //lv_coord_t  current_result; //计算当前的结果
			
				
			 //移动所有子对象
			 //
				#if 0
				lv_obj_move_children_by(img1/*window_manger[WINDOW_SCROLL_MENU].window_obj*/, vect.x, vect.y, true);
				#else
				
				for(int i= 0;	i<child_cnt; i++)
				{
					lv_obj_t * obj = lv_obj_get_child(window_manger[WINDOW_SCROLL_MENU].window_obj,i); //获取指定索引的子对象
					
					
					lv_coord_t width=lv_obj_get_width(obj);    //获取当前对象宽度
					lv_coord_t height=lv_obj_get_height(obj);  //获取当前对象高度

					//获取当前对象的坐标
					lv_coord_t x_pos  =	 lv_obj_get_x(obj); 
					lv_coord_t y_pos  =  lv_obj_get_y(obj);
					
					int16_t pos_x,pos_y;
					uint32_t result;
					
					
					//计算当前移动方向用于判断
					int16_t pos_x_last=0,pos_x_current=0,pos_x_result=0;
					int16_t pos_y_last=0,pos_y_current=0,pos_y_result=0;
					 
					//上一次的坐标
					pos_x_last = x_pos;   
					//当前的坐标
					pos_x_current =  x_pos +vect.x;
					pos_y_current =  y_pos +vect.y;
					//
					pos_x_result =  pos_x_last - pos_x_current;
					pos_y_result =  pos_y_last - pos_y_current;
					
					
					pos_x =	x_pos +vect.x + width /2;  //当前移动后的中心x坐标
					pos_y	= y_pos +vect.y + height/2; //当前移动后的中心y坐标
					
					if((pos_x_result > 0) && (pos_y_result > 0))   //左滑
					{		
							#if 1
							if((pos_x< X_POS_ROOM_POS) ||(pos_y< Y_POS_ROOM_POS) )
							{
								ZOOM_dir=DOWN;
							}else  //if(pos_x> 330)
							{
								ZOOM_dir=UP;
							}
							#else
								ZOOM_dir=DOWN;
							#endif
						
					//SEGGER_RTT_printf(0,"****************************************************LV_DIR_LEFT +  LV_DIR_UP pos_x_result=%d\r\n",pos_x_result);		
					}else  if( (pos_x_result == 0) && (pos_y_result == 0) )
					{
							ZOOM_dir=NONE;   //手指暂停
					}else                //右滑
					{
					//SEGGER_RTT_printf(0,"****************************************************LV_DIR_RIGHT  pos_x_result=%d\r\n",pos_x_result);		

						
						#if 1
							if( (pos_x < 360 -X_POS_ROOM_POS) && (pos_x > X_POS_ROOM_POS) &&(pos_y < 360 -Y_POS_ROOM_POS) && (pos_y > Y_POS_ROOM_POS) )
						{
							ZOOM_dir=UP;
						}else  //if(pos_x> 330)
						{
							ZOOM_dir=DOWN;
						}
						
						#else
						ZOOM_dir=UP;
						#endif
					
					//SEGGER_RTT_printf(0,"****************************************************LV_DIR_RIGHT + +  LV_DIR_DOWN  pos_x_result=%d\r\n",pos_x_result);		
					}
					
					
					
					
					
					//判断当前位置是否要缩小
					if( ((pos_x<X_POS_ROOM_POS)  || (pos_x>360 -X_POS_ROOM_POS)) || ((pos_y<Y_POS_ROOM_POS)  || (pos_y>360 - Y_POS_ROOM_POS))  )
					{
						#if 1
						if( Menu_index[i] !=0)
						{
							 zoom_flag=1;
						}
						#else
						//缩小标志
						 zoom_flag=1;
						SEGGER_RTT_printf(0,"zoom_flag down\r\n",pos_x);		
						#endif				

					}else 
					{
						 if( Menu_index[i] !=Max_Menu_MaxGrade)
						{
							 zoom_flag=1;
						}	
					}
					
					if(zoom_flag)
				{
							if(ZOOM_dir == DOWN)
							{
								Menu_index[i]=Menu_index[i]-1;
								
								if( Menu_index[i] <= 0)
								{
									Menu_index[i] = 0;
								}
								
								
								#if 0
								lv_img_t * img = (lv_img_t *)obj;
								img->obj_size_mode = LV_IMG_SIZE_MODE_VIRTUAL;
								//重新设置图标位置
								lv_coord_t width=lv_obj_get_width(obj);    //获取当前对象宽度
								lv_coord_t height=lv_obj_get_height(obj);  //获取当前对象高度	
								lv_img_set_zoom(obj, ((Menu_index[i]*50)%256 )); //缩小操作
								#else
								refresh_image(obj,i,Menu_index[i]);
								#endif

								
							
								#if 1
								lv_obj_set_pos(obj,x_pos +vect.x/* + width/2*/,y_pos + vect.y /*+height/2*/); //移动当前对象到指定位置
								#else
								lv_obj_set_pos(obj,x_pos+ Icon_Size[i] +vect.x/* + width/2*/,(y_pos+Icon_Size[i]) + vect.y /*+height/8*/); //移动当前对象到指定位置
								#endif
								
								
								zoom_flag=0;
								ZOOM_dir = NONE;
								continue;
					}else if(ZOOM_dir == UP)			
					{
									if((pos_x>0)/*&&(pos_x>10)*/)
									{	
										
//											SEGGER_RTT_printf(0,"****************************************************pos_x=%d\r\n",pos_x);	
											Menu_index[i]=Menu_index[i]+1;	
											//判断当前的是否越界
											if( Menu_index[i] > Max_Menu_MaxGrade)
											{
												 Menu_index[i]= Max_Menu_MaxGrade;
											}
											
										 #if 0
										lv_img_t * img = (lv_img_t *)obj;
										img->obj_size_mode = LV_IMG_SIZE_MODE_VIRTUAL;
										//重新设置图标位置
										lv_coord_t width=lv_obj_get_width(obj);    //获取当前对象宽度
										lv_coord_t height=lv_obj_get_height(obj);  //获取当前对象高度	
										lv_img_set_zoom(obj, ((Menu_index[i]*50)%256 )); //缩小操作
										#else
										refresh_image(obj,i,Menu_index[i]);
										#endif
											

										#if 1
										lv_obj_set_pos(obj,x_pos +vect.x/* + width/2*/,y_pos + vect.y /*+height/2*/); //移动当前对象到指定位置
										#else
										lv_obj_set_pos(obj,x_pos+Icon_Size[i] +vect.x,(y_pos+Icon_Size[i]) + vect.y); //移动当前对象到指定位置
										#endif
											
										zoom_flag=0;
										ZOOM_dir = NONE;
										continue;		
									}
					}

				}
					lv_obj_set_pos(obj,x_pos +vect.x ,y_pos + vect.y); //移动当前对象到指定位置		
				}
				

				#endif

			#endif
			
			

	
  #endif

}

void window_zoom_init()
{

    #if 1
		lv_obj_t *about =NULL;
		lv_obj_t *basketball = NULL;
		lv_obj_t *badminton = NULL;
		lv_obj_t *bp = NULL;
		lv_obj_t *dial = NULL;
		lv_obj_t *breath = NULL;
		lv_obj_t *brightness = NULL;
		lv_obj_t *climb = NULL;
		lv_obj_t *cycling = NULL;
		lv_obj_t *lcd = NULL;
		lv_obj_t *find_phone = NULL;
		lv_obj_t *home = NULL;
		lv_obj_t *hr = NULL;
		lv_obj_t *message = NULL;
		lv_obj_t *music = NULL;
		lv_obj_t *o2 = NULL;
		lv_obj_t *photograph = NULL;
		lv_obj_t *QRcode = NULL;
		lv_obj_t *reset = NULL;

		#if 1	
		
		//第一行
	  dial = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(dial, &z_z_menu_slide_Small_BP_64);         
		lv_obj_set_pos(dial  ,X_CENTER_X_POS -X_INTERVAL*2    +2* X_INTERVAL_ROW,Y_CENTER_Y_POS -2*Y_INTERVAL);	

		

		breath = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(breath, &z_z_menu_slide_Small_camera_64);         
		lv_obj_set_pos(breath,X_CENTER_X_POS - X_INTERVAL     +2*X_INTERVAL_ROW,Y_CENTER_Y_POS -2*Y_INTERVAL);	
		

		//中心点
	  brightness = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(brightness, &z_z_menu_slide_Small_Calculator_64);         
		lv_obj_set_pos(brightness, X_CENTER_X_POS  +2*X_INTERVAL_ROW	,Y_CENTER_Y_POS -2*Y_INTERVAL);




		
		
		//第一行
	  find_phone = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(find_phone, &z_z_menu_slide_Small_CountDown_64);         
		lv_obj_set_pos(find_phone  ,X_CENTER_X_POS -X_INTERVAL*2    + X_INTERVAL_ROW,Y_CENTER_Y_POS -Y_INTERVAL);	

		

		home = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(home, &z_z_menu_slide_Small_data_64);         
		lv_obj_set_pos(home,X_CENTER_X_POS - X_INTERVAL     +X_INTERVAL_ROW,Y_CENTER_Y_POS -Y_INTERVAL);	
		

		//中心点
	  QRcode = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(QRcode, &z_z_menu_slide_Small_hr_64);         
		lv_obj_set_pos(QRcode, X_CENTER_X_POS  +X_INTERVAL_ROW	,Y_CENTER_Y_POS -Y_INTERVAL);
		
		
		reset = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(reset, &z_z_menu_slide_Small_message_64);         
		lv_obj_set_pos(reset,X_CENTER_X_POS + X_INTERVAL+ +X_INTERVAL_ROW,Y_CENTER_Y_POS -Y_INTERVAL);	
		
	
		//第二行
	  music = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(music, &z_z_menu_slide_Small_met_64);         
		lv_obj_set_pos(music  ,X_CENTER_X_POS -X_INTERVAL*2,Y_CENTER_Y_POS);	

		

		o2 = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(o2, &z_z_menu_slide_Small_music_64);         
		lv_obj_set_pos(o2,X_CENTER_X_POS - X_INTERVAL,Y_CENTER_Y_POS);	
		

		//中心点
	  photograph = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(photograph, &z_z_menu_slide_Small_Outdoorsports_64);         
		lv_obj_set_pos(photograph, X_CENTER_X_POS	,Y_CENTER_Y_POS);
		
		
		hr = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(hr, &z_z_menu_slide_Small_Phone_64);         
		lv_obj_set_pos(hr,X_CENTER_X_POS + X_INTERVAL,Y_CENTER_Y_POS);	
		
		
		
		message = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(message, &z_z_menu_slide_Small_settings_64);         
		lv_obj_set_pos(message,X_CENTER_X_POS +X_INTERVAL*2,Y_CENTER_Y_POS);	
		
		
   //第三行
	  about = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(about, &z_z_menu_slide_Small_Sleep_64);         
		lv_obj_set_pos(about  ,X_CENTER_X_POS -X_INTERVAL*2    + X_INTERVAL_ROW,Y_CENTER_Y_POS +Y_INTERVAL);	

		

		badminton = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(badminton, &z_z_menu_slide_Small_spo2_64);         
		lv_obj_set_pos(badminton,X_CENTER_X_POS - X_INTERVAL     +X_INTERVAL_ROW,Y_CENTER_Y_POS +Y_INTERVAL);	
		

		//中心点
	  basketball = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(basketball, &z_z_menu_slide_Small_Stopwatch_64);         
		lv_obj_set_pos(basketball, X_CENTER_X_POS  +X_INTERVAL_ROW	,Y_CENTER_Y_POS +Y_INTERVAL);
		
		
		bp = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(bp, &z_z_menu_slide_Small_weather_64);         
		lv_obj_set_pos(bp,X_CENTER_X_POS + X_INTERVAL+ +X_INTERVAL_ROW,Y_CENTER_Y_POS +Y_INTERVAL);	
		
		
		//第一行
	  climb = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(climb, &z_z_menu_slide_Small_weather_64);         
		lv_obj_set_pos(climb  ,X_CENTER_X_POS -X_INTERVAL*2    +2* X_INTERVAL_ROW,Y_CENTER_Y_POS +2*Y_INTERVAL);	

		

		cycling = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(cycling, &z_z_menu_slide_Small_Stopwatch_64);         
		lv_obj_set_pos(cycling,X_CENTER_X_POS - X_INTERVAL     +2*X_INTERVAL_ROW,Y_CENTER_Y_POS +2*Y_INTERVAL);	
		

		//中心点
	  lcd = lv_img_create(window_manger[WINDOW_SCROLL_MENU].window_obj);
    lv_img_set_src(lcd, &z_z_menu_slide_Small_spo2_64);         
		lv_obj_set_pos(lcd, X_CENTER_X_POS  +2*X_INTERVAL_ROW	,Y_CENTER_Y_POS +2*Y_INTERVAL);
		
			
		#endif

					
#endif		
		
		child_cnt = lv_obj_get_child_cnt(window_manger[WINDOW_SCROLL_MENU].window_obj);  					 //获取当前的对象子对象个数
		memset(Menu_index,Max_Menu_MaxGrade,Max_Menu_Num); //将缩放拷贝到变量中 默认最大无缩放
//		for(int i=0;i<Max_Menu_Num;i++)
//		SEGGER_RTT_printf(0,"Menu_index[%d]=%d,child_cnt=%d\r\n",i,Menu_index[i],child_cnt);				

		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		
		lv_obj_add_flag(window_manger[WINDOW_SCROLL_MENU].window_obj,LV_OBJ_FLAG_CLICKABLE ); //增加可以长按的属性
		lv_obj_add_state(window_manger[WINDOW_SCROLL_MENU].window_obj,LV_STATE_PRESSED);
    lv_obj_set_scrollbar_mode(window_manger[WINDOW_SCROLL_MENU].window_obj, LV_SCROLLBAR_MODE_OFF);  //取消滚动条显示

	  //增加滑动处理函数
		lv_obj_add_event_cb(window_manger[WINDOW_SCROLL_MENU].window_obj,my_event_cb,LV_EVENT_PRESSING /*| LV_EVENT_RELEASED*/,NULL);   //添加对象回调函数
}
